home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / gc103.zip / GC102.BAS < prev    next >
BASIC Source File  |  1990-01-03  |  2KB  |  68 lines

  1. 100     '
  2. 105     ' gc.bas
  3. 110     '
  4. 115     ' Great Circle.  This program is used to determine bearing
  5. 120     ' and range to a station given the latitude and longitude
  6. 125     ' of both stations.
  7. 130     '
  8. 135     ' Ver 1.02 Public Domain (p) November 1989 By S. R. Sampson, N5OWK
  9. 145     '
  10. 150     ' Ref: Air Force Manual 51-40, "Air Navigation", 1 February 1987
  11. 155     '
  12. 160     RADIAN = (180 / 3.14159)
  13. 165     GOTO 215
  14. 170     '
  15. 175     T = INT(V1) : V1 = V1 - T : V1 = V1 / .6 : V1 = (T + V1)
  16. 180     RETURN
  17. 185     '
  18. 190     ACOS = -ATN(TMP / SQR(1 - TMP * TMP)) + 1.570796
  19. 195     RETURN
  20. 200     '
  21. 205     ' Get the user data
  22. 210     '
  23. 215     PRINT "East Longitudes and South Latitudes are negative" : PRINT
  24. 220     PRINT
  25. 225     INPUT "Latitude of your QTH [+-]dd.mm : ", V1
  26. 230     GOSUB 175
  27. 235     IF V1 > 90 OR V1 < -90 THEN 225
  28. 240     L1 = V1
  29. 245     INPUT "Longitude of your QTH [+-]ddd.mm : ", V1
  30. 250     GOSUB 175
  31. 255     IF V1 > 180 OR V1 < -180 THEN 245
  32. 260     A1 = V1
  33. 265     PRINT
  34. 270     INPUT "Latitude of destination [+-]dd.mm : ", V1
  35. 275     GOSUB 175
  36. 280     IF V1 > 90 OR V1 < -90 THEN 270
  37. 285     L2 = V1
  38. 290     INPUT "Longitude of destination [+-]ddd.mm : ", V1
  39. 295     GOSUB 175
  40. 300     IF V1 > 180 OR V1 < -180 THEN 290
  41. 305     A2 = V1
  42. 310     '
  43. 315     ' Compute the Bearing and Range, From the Formula in Chapter 23
  44. 320     '
  45. 325     DELTA = A2 - A1
  46. 330     '
  47. 335     ' Convert variables to Radians
  48. 340     '
  49. 345     L1 = L1 / RADIAN
  50. 350     A1 = A1 / RADIAN
  51. 355     L2 = L2 / RADIAN
  52. 360     DELTA = DELTA / RADIAN
  53. 365     TMP = (SIN(L1) * SIN(L2)) + (COS(L1) * COS(L2) * COS(DELTA))
  54. 370     GOSUB 190
  55. 375     DIST = ACOS
  56. 380     RANGE = 60 * (DIST * RADIAN)
  57. 385     TMP = (SIN(L2) - (SIN(L1) * COS(DIST))) / (SIN(DIST) * COS(L1))
  58. 390     GOSUB 190
  59. 395     BEARING = ACOS * RADIAN
  60. 400     IF DELTA > 0 THEN BEARING = 360 - BEARING
  61. 405     '
  62. 410     ' Computations complete, show answer
  63. 415     '
  64. 420     PRINT
  65. 425     PRINT "Bearing is "; BEARING; " Degrees for "; RANGE; " Nautical Miles"
  66. 430     PRINT
  67. 435 END
  68.